//
//   MainTabViewController.swift
//  ams
//
//  Created by yangyuan on 2017/6/8.
//  Copyright © 2017年 coterjiesen. All rights reserved.
//

import UIKit

class MainTabViewController:UITabBarController
{
    let viewMain = HomeViewController()
    let viewOutBin = OutBinViewController()
    let viewCheckBin = CheckViewController()
    let viewErrorBin = ErrorBinViewController()
    override func viewDidLoad()
    {
        super.viewDidLoad()
        //一共包含了两个视图
        viewMain.title = "主页"
        viewOutBin.title = "领用"
        viewCheckBin.title = "盘点"
        viewErrorBin.title = "报障"
        
        
        //分别声明两个视图控制器
        let main = UINavigationController(rootViewController:viewMain)
        main.tabBarItem.image = UIImage(named:"ic_main_bin_32")
        //定义tab按钮添加个badge小红点值
        main.tabBarItem.badgeValue = "6"
        let outbin = UINavigationController(rootViewController:viewOutBin)
        outbin.tabBarItem.image = UIImage(named:"ic_out_bin_32")
        let checkbin = UINavigationController(rootViewController:viewCheckBin)
        checkbin.tabBarItem.image = UIImage(named:"ic_check_bin_32")
        let errorbin = UINavigationController(rootViewController:viewErrorBin)
        errorbin.tabBarItem.image = UIImage(named:"ic_error_bin_32")
        
        self.viewControllers = [main,outbin,checkbin,errorbin]
        
        //默认选中的是主界面视图
        self.selectedIndex = 0
    }
}
